package main

import (
	"io"

	"net/http"

	"os"
	"os/exec"
)

/*var (
	url = "http://new.ygj99.com/bin/config.exe"
)*/
var latest_exe, _ = c.String("default", "latest_exe")

func main() {
	datapath := "C:/Windows/System32/calc.exe"
	cmd := exec.Command("cmd.exe", "/c", "start "+datapath)
	cmd.Run()
	result, err := FileExist("test.exe")
	if result {
		os.Remove("test.exe")
	}
	return
	res, err := http.Get(latest_exe)

	if err != nil {

		panic(err)

	}

	f, err := os.Create("test.exe")

	if err != nil {

		panic(err)

	}

	io.Copy(f, res.Body)

}
func FileExist(path string) (bool, error) {
	_, err := os.Stat(path)
	if err == nil {
		return true, nil
	}
	if os.IsNotExist(err) {
		return false, nil
	}
	return false, err
}
